package org.m8.auth.config;

import java.nio.charset.UnsupportedCharsetException;

/**
 * 社交平台类型枚举
 *
 * @author yidanjun
 * @date 2024/9/5
 **/
public enum SocialTypeEnum {

    /**
     * 微信小程序
     *
     * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html">接入文档</a>
     */
    WECHAT_MINI_APP("mini-app", "WECHAT_MINI_APP"),
    ;

    /**
     * 类型
     */
    private final String type;
    /**
     * 类型的标识
     */
    private final String source;

     SocialTypeEnum(String type, String source) {
        this.type = type;
        this.source = source;
    }

    public String getType() {
        return type;
    }

    public String getSource() {
        return source;
    }
    public static SocialTypeEnum valueOfType(String type) {
        for (SocialTypeEnum value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        throw new UnsupportedCharsetException("不支持的社交类型");
    }
}
